package com.chenlil.download;

import lombok.extern.slf4j.Slf4j;
import okhttp3.Call;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@Slf4j
public class DemoDownloadApplication implements ApplicationRunner {

    public static void main(String[] args) {
        SpringApplication.run(DemoDownloadApplication.class, args);
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        OkHttpClient client = new OkHttpClient.Builder().build();
        Request request = new Request.Builder().url("http://doordustorage.oss-cn-shenzhen.aliyuncs.com/doordu_admin/other/20190216/e85cc96c26a4744b74c1550320249838.png").build();
        Call call = client.newCall(request);

        Response execute = call.execute();
        log.info("响应码：{}",execute.code());

    }
}
